package com.ztmg.water.controller.water;

import com.github.pagehelper.PageInfo;
import com.ztmg.common.util.resultUtils.JsonResult;
import com.ztmg.water.dto.water.RefundInfoDTO;
import com.ztmg.water.dto.water.RefundInfoPageDTO;
import com.ztmg.water.service.water.RefundInfoService;
import com.ztmg.water.vo.water.RefundInfoVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@Api(description = "退款接口")
@RestController
@RequestMapping(value = "/refundInfo")
public class RefundInfoController {
    @Resource
    private RefundInfoService refundInfoService;

    @PostMapping("create")
    @ApiOperation("新增")
    public JsonResult create(@RequestBody RefundInfoDTO dto){
        return refundInfoService.create(dto);
    }

    @PostMapping("update")
    @ApiOperation("修改")
    public JsonResult update(@RequestBody RefundInfoDTO dto){
        return refundInfoService.update(dto);
    }

    @GetMapping("detail/{id}")
    @ApiOperation("详情")
    public JsonResult<RefundInfoVO> detail(@PathVariable Integer id){
        return refundInfoService.selectById(id);
    }

    @PostMapping("select")
    @ApiOperation("条件查询")
    public JsonResult<List<RefundInfoVO>> detail(@RequestBody RefundInfoDTO dto){
        return refundInfoService.select(dto);
    }

    @PostMapping("queryPage")
    @ApiOperation("分页查询")
    public JsonResult<PageInfo<RefundInfoVO>> queryPage(@RequestBody RefundInfoPageDTO dto){
        return refundInfoService.selectPage(dto);
    }

    @PostMapping("delete")
    @ApiOperation("条件删除")
    public JsonResult delete(@RequestBody RefundInfoDTO dto){
        return refundInfoService.delete(dto);
    }

    @GetMapping("deleteById/{id}")
    @ApiOperation("删除")
    public JsonResult deleteById(@PathVariable Integer id){
        return refundInfoService.deleteById(id);
    }

}
